package cn.edu.scau.cmi.ChenKaihui.composite.safe;

import java.util.ArrayList;
import java.util.List;

public class SafeComposite extends SafeComponent{

	//用于存放员工
	List<SafeComponent> subordinates = new ArrayList<SafeComponent>();
	
	public SafeComposite(String name){
		this.name = name;
	}
	
	public void addChild(SafeComposite safeComposite) {
		subordinates.add(safeComposite);
		System.out.println("成功添加下级员工: " + safeComposite.getName());
	}
	
	public void delete(SafeComposite safeComposite) {
		subordinates.remove(safeComposite);
		System.out.println("成功删除下级员工: " + safeComposite.getName());
	}
}
